Skip to content

Add support for Rgbic Neon Rope Light#452

Open
XiaoLing-git wants to merge 9 commits intosblibs:masterfrom
XiaoLing-git:add_light_0228
Open

Add support for Rgbic Neon Rope Light#452
XiaoLing-git wants to merge 9 commits intosblibs:masterfrom
XiaoLing-git:add_light_0228

Conversation

@XiaoLing-git
Copy link

  1. Rgbic Neon Rope Light
  2. Rgbic Neon Wire Rope Light

@codecov
Copy link

codecov bot commented Feb 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
switchbot/__init__.py 100.00% <ø> (ø)
switchbot/adv_parser.py 97.81% <ø> (ø)
switchbot/const/__init__.py 100.00% <100.00%> (ø)
switchbot/devices/light_strip.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial support for SwitchBot RGBIC Neon Rope Light / Neon Wire Rope Light by extending model constants, advertisement parsing, and introducing a dedicated neon light-strip device class, with accompanying test updates.

Changes:

  • Add new SwitchbotModel entries for RGBIC Neon Rope Light and RGBIC Neon Wire Rope Light.
  • Extend adv_parser.SUPPORTED_TYPES to recognize the new model identifiers.
  • Add SwitchbotRgbicNeonLight device class and update tests to include the new model.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
switchbot/const/__init__.py Adds enum constants for the two new neon models.
switchbot/adv_parser.py Adds SUPPORTED_TYPES entries for new neon rope/wire model IDs.
switchbot/devices/light_strip.py Introduces SwitchbotRgbicNeonLight (RGB-only) device class.
switchbot/__init__.py Exports SwitchbotRgbicNeonLight from the package.
tests/test_adv_parser.py Adds advertisement parsing test vectors for RGBIC Neon Rope Light.
tests/__init__.py Adds RGBIC_NEON_LIGHT_INFO test fixture data.
tests/test_strip_light.py Adds neon device to parametrized strip-light tests and adjusts assertions.
.idea/workspace.xml Adds IDE workspace file (should not be committed).
Files not reviewed (1)
  • .idea/workspace.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +377 to +381
@property
def color_modes(self) -> set[ColorMode]:
"""Return the supported color modes."""
return {ColorMode.RGB}

Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwitchbotRgbicNeonLight.color_modes reports RGB-only support, but the class still inherits _set_color_temp_command from SwitchbotLightStrip, making set_color_temp appear supported. If neon devices truly don't support color temperature, override _set_color_temp_command to an empty string (or override set_color_temp to raise) so unsupported operations fail fast and match color_modes.

Copilot uses AI. Check for mistakes.
Comment on lines +3578 to +3592
AdvTestCase(
b"@L\xca!pz/\x8b'\x00\x11:\x00",
b"\x00\x00\x00\x00\x10\xd0\xb6",
{
"sequence_number": 47,
"isOn": True,
"brightness": 11,
"delay": False,
"network_state": 2,
"color_mode": 7,
},
b"\x00\x10\xd0\xb6",
"RGBIC Neon Rope Light",
SwitchbotModel.RGBIC_NEON_ROPE_LIGHT,
),
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description mentions both "RGBIC Neon Rope Light" and "RGBIC Neon Wire Rope Light", but tests only cover SwitchbotModel.RGBIC_NEON_ROPE_LIGHT. Add analogous advertisement parsing test cases for the wire rope light model IDs (...\xd0\xb5) so both additions are validated.

Copilot uses AI. Check for mistakes.
(FLOOR_LAMP_INFO, light_strip.SwitchbotStripLight3),
(RGBICWW_STRIP_LIGHT_INFO, light_strip.SwitchbotRgbicLight),
(RGBICWW_FLOOR_LAMP_INFO, light_strip.SwitchbotRgbicLight),
(RGBIC_NEON_LIGHT_INFO, light_strip.SwitchbotRgbicNeonLight),
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixture adds SwitchbotRgbicNeonLight into the same parametrized device set as devices that support color temperature. Many of the tests below assume color-temp support (e.g., set/validate color_temp and set_color_temp), which is inconsistent with SwitchbotRgbicNeonLight.color_modes returning only ColorMode.RGB. Consider splitting the fixture (or parametrizing expected capabilities) so tests only exercise operations supported by each device model.

Suggested change
(RGBIC_NEON_LIGHT_INFO, light_strip.SwitchbotRgbicNeonLight),

Copilot uses AI. Check for mistakes.
Comment on lines +365 to +375
async def verify_encryption_key(
cls,
device: BLEDevice,
key_id: str,
encryption_key: str,
model: SwitchbotModel = SwitchbotModel.RGBICWW_STRIP_LIGHT,
**kwargs: Any,
) -> bool:
return await super().verify_encryption_key(
device, key_id, encryption_key, model, **kwargs
)
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify_encryption_key on SwitchbotRgbicNeonLight also defaults model to SwitchbotModel.RGBICWW_STRIP_LIGHT. This should align with the neon model(s), otherwise encryption verification may be performed against the wrong model identifier when callers use the default.

Copilot uses AI. Check for mistakes.
Comment on lines 99 to 103
assert device.is_on() is True
assert device.on is True
assert device.color_mode == ColorMode.RGB
assert device.color_modes == {
ColorMode.RGB,
ColorMode.COLOR_TEMP,
}
assert ColorMode.RGB in device.color_modes
assert device.rgb == (30, 0, 0)
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The color_modes assertion was weakened from an exact set check to only verifying ColorMode.RGB is present. This reduces coverage for models that should also support ColorMode.COLOR_TEMP (e.g., Strip Light 3 / RGBICWW devices). Prefer asserting the full expected set per model so regressions in supported modes are caught, while still allowing neon to be RGB-only.

Copilot uses AI. Check for mistakes.
XiaoLing-git and others added 2 commits March 2, 2026 10:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are unrelated changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants